package org.example.j2024_11_9;

import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/header")
public class HeaderController {
    @RequestMapping("/h1")
    public String h1(HttpServletRequest request){
        String header = request.getHeader("User-Agent");
        return header ;
    }
    @RequestMapping("/h2")
    public String h2(@RequestHeader(value = "User-Agent") String user)
    {
        return user;
    }
}
